import { MyModel } from '../../../modules/my.js';

const app = getApp();
const my = new MyModel();

Page({
  data: {
    positions: [],
    loading: false
  },
  // 加载收列表
  loadLive() {
    my.getPositionList()
    .then(res => {
      if(res.code == 2) {
        this.setData({
          positions: res.data.collectionPositions,
          loading: true
        })
      }else {
        this.setData({
          loading: true
        })
      }
    })
  },
  onShow: function () {
    app.isAuthize()
    .then(res => {
      if(res) {
        this.loadLive()
      }else {
        this.setData({
          loading: true
        })
      }
    })
  }
})